import java.util.Arrays;

public class Solution1025 {

    public boolean divisorGame(int n) {
        int[] f=new int[n+1];
        Arrays.fill(f,-1);
        return dfs(f,n);

    }

    private boolean dfs(int[] f, int n) {
        if (f[n]!=-1){
            return f[n]==1;
        }
        boolean flag=false;
        for (int i=1;i<n;i++){
            if (n%i==0 && !dfs(f,n-i)){
                flag=true;
            }
        }
        f[n]=flag?1:0;
        return flag;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1025().divisorGame(3));
    }
}
